package com.oceansoft.mobile.biz.api.entity;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import org.springframework.jdbc.core.RowMapper;

public class News {
	private int id;
	private String title;
	private String orginalUrl;
	private Date pubTime;
	private String author;
	private String content;
	private String imgUrl;
	private int status;
	
	public static int NEWS_UNSEND = 0;
	public static int NEWS_SEND = 1;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getOrginalUrl() {
		return orginalUrl;
	}
	public void setOrginalUrl(String orginalUrl) {
		this.orginalUrl = orginalUrl;
	}
	public Date getPubTime() {
		return pubTime;
	}
	public void setPubTime(Date pubTime) {
		this.pubTime = pubTime;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getImgUrl() {
		return imgUrl;
	}
	public void setImgUrl(String imgUrl) {
		this.imgUrl = imgUrl;
	}
	
	
    public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	public static RowMapper<News> getNewsRowMapper() {
        return new RowMapper<News>() {
            public News mapRow(ResultSet rs, int rowNum) throws SQLException {
            	News news = new News();
        		news.setId(rs.getInt("id"));
        		news.setTitle(rs.getString("title"));
        		news.setOrginalUrl(rs.getString("orginal_url"));
        		news.setPubTime(rs.getTimestamp("pub_time"));
        		news.setAuthor(rs.getString("author"));
        		news.setContent(rs.getString("content"));
        		news.setImgUrl(rs.getString("img_url"));
        		news.setStatus(rs.getInt("status"));
                return news;
            }
        };
    }
}
